package org.gpp.proj1.bone;

public class Animation {
	
	private final String name;
	private final KeyframeInterval interval;
	private final int loopFrame;
	private boolean loops;

	public Animation( String name, KeyframeInterval interval, boolean loops, int loopFrame ) {
		
		assert name != null : "Cannot create an animation with a null name";
		assert interval != null : "Cannot create an animation with a null interval";
		
		if( loops ) {
			assert loopFrame >= interval.getBegin() && loopFrame <= interval.getEnd() :
						"Animation's looping frame must be within the interval";
		}
		
		this.name = name;
		this.interval = interval;
		this.loops = loops;

		this.loopFrame = loops ? loopFrame : interval.getBegin();
	}
	
	public Animation( String name, KeyframeInterval interval ) {
		
		this( name, interval, false, 0 );
	}

	public boolean loops() {
		return loops;
	}
	
	public int getLoopFrame() {
		return loopFrame;
	}

	public String getName() {
		return name;
	}
	
	public KeyframeInterval getInterval() {
		return interval;
	}
}
